Repository navigation
Review rules: T3 side of findings, scans and rounds on shared vectors - #781
Conversation
Lens BVerdict: NOT SAFE (head a2cd860). One blocker: CI's Lint job is red, and the reason is a real gap. A pull request that changes only the gate or the vectors never runs the TypeScript side. Focus: tests, maintenance, CI, and crafted-input time. I asked the state question too (runs again, stops half-way, old, empty or missing state). Blocker
Major
Minor
What I checked
|
Lens A (parity and bypass), head a2cd860Verdict: SAFE to merge. The gate itself does not change: BlockingNone. Major
Minor
What I checked
|
Fix roundCommits
Red on the old code: the new scan vectors fail on the old TS (3 tests). The Red checks (each line removed, then restored):
State question: running again gives the same answer (pure functions, a named test). Stopping half-way writes no state. Old, empty and missing state: an older valid read is kept when a newer post reads nothing, and a correct new post does not clear the bad one. An override comment that looks like a report is never one. A missing Tests on Linux, after the merge of main: TS |
A pure TypeScript copy of the CI gate's review rules (path plan, lens comment headers and scan, findings, rounds) under apps/server/src/fork/reviewRules, so T3 tools and the gate agree. Both sides replay review.vectors.json, which gains findings, scans and rounds sections; each side fails on a section or field it does not run. The Python findings tables move into the vectors file (one source). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ectors - fork-owned-paths: the shared review vectors and the lens corpus are not fork-owned, so a change to the gate and its vectors runs the server's review-rules test (its Lint check reads them). - lensComment.ts ports lens_problem: a report whose first line is a valid header but which holds a second lens header (quoted, fenced, plain or loose) reads nothing, exactly as the gate judges it. 18 new shared scan vectors, generated from the gate's answers. - Gate and TS copy: a table row is plain-folded once per row and the "first non-empty cell after j" is one backward pass, so a wide row reads in linear time (was quadratic in cells). Same answers; timing tests on both sides. - Gate: a number reference past int's 4,300-digit limit no longer raises in html.unescape; it reads as its value (or U+FFFD past Unicode), as the TS copy already did. Two shared vectors. - README: how a vector is made. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ced9df0 to
8735762
Compare
…pure logic) (#825) * Review rules T3a: lens_start's plan, prompt, refusals and request ids (pure logic) New fork files next to the review-rules logic of #781. Nothing registers a tool yet. - planLensStart: per pull request and batch plan. Required lenses come from planReview and requiredLenses, the round from judgeRounds (the gate's own rules), so lens_start cannot require fewer lenses than the gate. A lens whose newest report already read the head (or the same change) is not started again. A batch gives one child per lens that reads every pull request needing it and posts one report per pull request, each with that pull request's head. - Refusals: rules off (unset, empty, off, unreadable), a bad call, an unknown, closed or merged pull request, a caller head GitHub does not name, no plan (unreadable change, no rule, a lens prompt not read), round past the cap, a person's override already on the head. - confirmLensStart: just before starting, a child whose pull request moved or closed is refused. - lensRequestId: same lens and heads = same id, in any order; fits delegate_task's 256 chars. - The server builds the prompt: read only, the lens text, the state question word for word with a `state:` line, finding prefixes, report size, round and earlier reads. - Tests replay every shared case, round and scan vector (counts checked) and answer the state question: same start twice, head moved, old/empty settings, round at the cap, partial batch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Review rules T3a: lens_start plans what the gate reads (fix round A+B) - Restart every lens entry that does not name the head once anything must start, required or not: the gate needs every lens comment on one head. An entry lens_start cannot start (no header, unknown lens) is refused with what a person does. A newer override the gate counts is honoured. - Read the gate's required-lenses input and the review block's mode; without a block the input names the lenses (built-in prompt), and an empty input outside enforce, a bad name or a bad mode is refused. - Plan each pull request of a batch with its own base branch's rules. - Earlier lens children: an ended one restarts as the next attempt (replaces + note), a running one is returned, never started twice. - Repo and heads read lower-case; the approach lens runs on the approach runner by its role; lone-surrogate lens keys get a distinct id. - Tests: both lens-A scenarios, a property test over every shared vector state (the gate's verdict, modelled from its code, passes after the plan is carried out, or a person must act), and a test per new refusal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
What and why
T3 tools (review rules rows T3-T5, later) need to read lens comments, findings and rounds exactly as the CI gate does. This adds a pure TypeScript copy of the gate's review rules in
apps/server/src/fork/reviewRules/:plan.ts: which lenses a change needs (review_glob.py,review_judge.judge); input it cannot read throwsReviewPlanError, never "no lens needed".lensComment.ts: lens header, lens key, fence reading,lens_problem(a comment that only looks like a lens report, or holds a second header) and the lens scan (lens.py).findings.ts:read_findings, including the rule from fork-ci: enforce review findings, rounds and critical gate files #740 round 2 that a report has a findings section only with both a blocker and a major label.rounds.ts:review_round,judge_rounds(problem texts word for word), the summary line, and the required lenses with the approach lens.pyText.ts: Python's text rules where JavaScript differs: whitespace,\w/\b,re.Iwithİ/ı,splitlines,repr,html.unescape, code-point slicing and sorting, and digits in any script.One source.
fork-ci/actions/pr-queue/review.vectors.jsongainsfindings(133),scans(31) androunds(28) sections, plus the repository'soverride_prefix,, all generated from the Python gate's answers. The Python findings tables move into this file, so it is the only list. Both sides replay every vector. Each side also fails when the file has a section or field it does not run, or when a vector name appears twice. The README says how a vector is made.Gate changes (fix round), kept minimal, in
review_judge.pyonly:_read: a table row is plain-folded once per row, and "the first non-empty cell after cell j" comes from one backward pass. Before, both were done per cell, which is quadratic in cells (minutes on a full-size comment). The answers are the same.fold: a&#number reference longer than 7 digits is replaced by�(one past Unicode, so U+FFFD) beforehtml.unescape. Before, a reference with more than 4,300 digits madehtml.unescaperaise and the gate crash. TS already gave this answer.lens.pydoes not change..github/fork-owned-paths.txtmarks the vectors file and the lens corpus as not fork-owned (!lines), because the server test reads them, so a change to the gate and its vectors also runs the server tests.Size. This is over the row's ~400 lines: 852 lines of source plus a 340-line test. The vectors file adds about 1,700 lines of data. Most of the code is the Python text rules (
pyText.ts), which the vectors need to match exactly.Follow-ups for row T5: #799 (Unicode version drift, cases on only one side, the thinner
LensPostinput, and small wording items).Tests
apps/server/src/fork/reviewRules/reviewRules.test.ts(vitest, 23 tests): every glob, case, findings, scan and round vector; the gate corpus's 574lens_header/lens_keycalls; a section/field/duplicate-name guard; refusals; and the gate's linear-time lines (200,000 spaces; five full-size wide table rows; a full-size comment's lens problem), each with its own 2 s bound and the gate's answers. A first draft trimmed whitespace with a regex, which took 13 s on 50,000 spaces; this test caught it.review_judge.test.py(49, including a wide-table timing test with a 2 s bound per case),review_glob(8),review_config(51),lens(80) andhead_check(246) all pass. Server typecheck,vp fmt,vp lint, knip and the fork-seam check pass.fork-owned-reads(4) andfork-owned-paths(52) pass.KeyError: 'findings'), and the TS test has no module to run on main.seen >= set(BLOCKING)changed tobool(seen)), 170 findings-vector subtests and 4 round vectors fail. In TS, 3 tests fail, including every-findings-vector.lensProblemcall inlensScan, 3 TS tests fail (every-scan and two named state tests). Without the gate's table fix, its timing test runs past 90 s (bound: 2 s). Without the TS table fix, the TS timing test takes 117 s (bound: 2 s). Without the&#guard, 3 Python subtests raiseValueError. Without the!lines,fork-owned-readsand 3fork-owned-pathscases fail.\b, and heading-ends-a-bare-label.General vs project
All general. The rules, vectors and TS copy carry no project facts. Repo-specific settings stay in each repo's pr-queue config
reviewblock, which the TS side takes as input.Upstream fit
New fork-owned folder
apps/server/src/fork/reviewRules/only. No upstream file changes, and no seam is added.Review rules design row T2b
🤖 Generated with Claude Code